import OneTable from './OneTable/index.js'
import {
  initHeaderFunction
} from './OneTable/common/request.js'
import {
  toRawType
} from './OneTable/common/common.js'
const components = [OneTable]

const install = function(Vue, initHeaderConfig) {
  components.forEach(component => {
    Vue.component(component.name, component)
  })
  if (initHeaderConfig && toRawType(initHeaderConfig) === 'Obejct') {
    initHeaderFunction(initHeaderConfig)
  }
}

if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue)
}

export default {
  install,
  OneTable
}
